package com.portal.framework.page;


import java.util.ArrayList;
import java.util.Collection;


public class PageList extends ArrayList {
	private static final long serialVersionUID = 6714062260791420015L;
	private int recordAmount;//总数
    private int curPageNum;//页码
    private int curPageSize;//每页最大显示记录数
    private int pageTotal;//可分总页数
    private boolean isEnd;//是否已经到了末尾
    private boolean isFrist;//是否已经到了首页
    private String strSQL;//分页条件���
    public String getStrSQL() {
		return strSQL;
	}

	public void setStrSQL(String strSQL) {
		this.strSQL = strSQL;
	}

	public PageList() {
        super();
    }

    public PageList(int initialCapacity) {
        super(initialCapacity);
    }

    public PageList(Collection c) {
        super(c);
    }
    public int getRecordAmount() {
        return recordAmount;
    }

    public int getCurPageNum() {
        return curPageNum;
    }

    public int getCurPageSize() {
        return curPageSize;
    }

    public void setRecordAmount(int recordAmount) {
        this.recordAmount = recordAmount;
    }

    public void setCurPageNum(int curPageNum) {
        this.curPageNum = curPageNum;
    }

    public void setCurPageSize(int curPageSize) {
        this.curPageSize = curPageSize;
    }
    public boolean getIsEnd(){
        isEnd=(getPageTotal()==getCurPageNum()) ? true : false;
        return isEnd;
    }
    public boolean getIsFrist(){
        isFrist=(getCurPageNum()==1) ? true : false;
        return isFrist;
    }
    public int getPageTotal() {
        if(getCurPageSize()==0)
            return 1;
        pageTotal = (getRecordAmount() % curPageSize == 0) ?
                    (getRecordAmount() / curPageSize) :
                    (getRecordAmount() / curPageSize + 1);
        return this.pageTotal;
    }

    public void setPageTotal(int pageTotal) {
        this.pageTotal = pageTotal;
    }
}
